package edu.sctu.practice.class02.shilaihong.assign03.text2;

/**
 * Created by admin on 2015/10/29.
 */
public class ComparableCylinder extends Cylinder {

    public ComparableCylinder(double r, double height) {
        this.r = r;
        this.height = height;

    }


    public int compaerTo(Object o) {
        if (getArea() >((ComparableCylinder) o).getArea()) {
            return 0;
        } else {
            return 1;
        }
    }
    private double getArea(){
        return r*r*Math.PI+2*Math.PI*height;
    }
}

